# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=powerfuzzer
pkgver=1_beta
pkgrel=8
pkgdesc="Powerfuzzer is a highly automated web fuzzer based on many other Open Source fuzzers available (incl. cfuzzer, fuzzled, fuzzer.pl, jbrofuzz, webscarab, wapiti, Socket Fuzzer). It can detect XSS, Injections (SQL, LDAP, commands, code, XPATH) and others."
url="http://www.powerfuzzer.com"
arch=('any')
depends=('python2' 'wxpython' 'python2-utidylib')
license=('GPL')
groups=('blackarch' 'blackarch-fuzzer')
source=("http://downloads.sourceforge.net/powerfuzzer/${pkgname}_v${pkgver}_patched.zip")
sha512sums=('c31301a2c5dd4c8cff96235cda33e84e3c78b2325c51e94c5c2f86e079604e5d4333521d77db0db3e9244a7c551058438e297e52d8c0a19553f53bd5e68ff3cf')

prepare(){
  grep -iRl 'python' "$srcdir/${pkgname}_v${pkgver}_patched" |
  xargs sed -i 's|#!.*/usr/bin/python|#!/usr/bin/python2|;s|#!.*/usr/bin/env python$|#!/usr/bin/env python2|'
}

package() {
  cd "${pkgname}_v${pkgver}_patched"

  chmod -x *

  rm COPYING

  chmod +x "$pkgname.py"

  install -dm 755 "$pkgdir/usr/share/$pkgname/"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  mkdir "$pkgdir/usr/bin"

  cd "$pkgdir/usr/bin"

  ln -sf "/usr/share/$pkgname/$pkgname.py" $pkgname
}

